import { fromJS } from 'immutable';
import * as actionTypes from './actionTypes';
const defaultState = fromJS({
    focused:false,
    muenShow:false,
    list:[],
    page:1,
    totlePage:1,
})

export default (state = defaultState,action) => {
    switch(action.type){
        case actionTypes.HANDLE_INPUT:
        return action.value ?state.set('focused',false): state.set('focused',true);
        case actionTypes.GIVE_STORE:
        return state.merge({
            list:action.searchList,
            totlePage:action.totlePage
        })
        case actionTypes.MOUSE_ENTER:
        return state.set('muenShow',true)
        case actionTypes.MOUSE_LEAVE:
        return state.set('muenShow',false)
        case actionTypes.CHANGE_PAGE:
        return state.set('page',action.value)
        default:
        return state;
    }
  
};